package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.CompenyDaoImpl;
import com.ysd.dao.impl.FishClassifyDaoImpl;
import com.ysd.dao.impl.TuJianChaDaoImpl;
import com.ysd.dao.impl.TuJianProductDaoImpl;
import com.ysd.entity.Compeny;
import com.ysd.entity.Details;
import com.ysd.entity.FishClassify;
import com.ysd.entity.NewsDetails;


public class HomeServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		CompenyDaoImpl cDao = new CompenyDaoImpl();//创建对象
		Compeny c = cDao.getCompeny();//调用方法
		request.setAttribute("c",c);//存入数据
		
		TuJianProductDaoImpl tuDao = new TuJianProductDaoImpl();//创建方法
		List<Details> ilsList = tuDao.getTuJian();//调用方法
		request.setAttribute("ilsList", ilsList);// 存入数据
		
		//引入产品分类中的dao.impl
		FishClassifyDaoImpl fishDao = new FishClassifyDaoImpl();
		List<FishClassify> fishClassifyList = fishDao.getFish();
		request.setAttribute("fishClassifyList", fishClassifyList);
		
		TuJianChaDaoImpl tuiDao =  new TuJianChaDaoImpl();
		List<NewsDetails> detList = tuiDao.getNewsList();
		request.setAttribute("detList", detList);
		
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
